const Router = require("koa-router");
const router = new Router({ prefix: "/comment" });
const { authorverify } = require("../middleware/auth.middleware");

const {
  byessay,
  reply,
  deletecom,
  thumb,
  byuser,
  mangetbyessay,
} = require("../controller/comment.controller");

//根据文章id查询评论
router.get("/byessay/:id", byessay);
//回复评论
router.post("/reply", authorverify, reply);
//删除评论
router.delete("/deletecom/:id", authorverify, deletecom);
//点赞评论或取消点赞
router.post("/thumb", authorverify, thumb);
//根据用户id查询评论
router.get("/byuser/:id", byuser);

//管理员根据文章id查询评论
router.get("/mangetbyessay/:id", authorverify, mangetbyessay);

module.exports = router;
